package com.chendong.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Author chendong
 * @Date 2021/8/9
 * @Description
 */
@RestController
public class OrderNacosController {
    @Autowired
    private RestTemplate restTemplate;
    @Value("${service-url.nacos-user-service}")
    private String serverUrl;
    @GetMapping(value = "/consumer/payment/{id}")
    public String paymentInfo(@PathVariable("id") Integer id) {
        String url = serverUrl+"/payment/"+id;
        return restTemplate.getForObject(url,String.class);
    }
}
